package com.cftpay.payexperience.usage.app;

import android.app.Application;
import android.content.Context;

import com.cftpay.payexperience.usage.util.PackageUtil;
import com.cftpay.payexperience.usage.util.PayLogUtil;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.beta.Beta;

import static com.tencent.bugly.beta.tinker.TinkerManager.getApplication;


public class PayApplication extends Application {

    private static final String APP_ID = "70ff1dde82";

    @Override
    public void onCreate() {
        super.onCreate();
        printPageckageInfo();
        Bugly.init(this, APP_ID, true);
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        // 安装tinker
        Beta.installTinker();
    }

    private void printPageckageInfo() {
        PackageUtil.getInstance().init(getApplication());
        PackageUtil appPackage = PackageUtil.getInstance();
        String packageName = appPackage.getPackageName();
        String versionCode = appPackage.getVersionCode();
        String versionName = appPackage.getVersionName();
        PayLogUtil.logSecond("packageName = " + packageName + " versionCode = " + versionCode + " versionName = " + versionName);
    }

}